#ifndef _Config_H
#define _Config_H

#if defined(__C30__)
#include <p24Fxxxx.h>
#endif



#if defined __18CXX
#include <p18f4520.h>
#define calloc(nmemb, size) (malloc ((nmemb) * (size)))
#endif


#include <Generic.h>
#include <OSA.h>


//*************************************************************************/



/******* G E N E R I C   D E F I N I T I O N S ************************************************/

#define	HIGH	1
#define	LOW		0
#define	OUTPUT	0
#define	INPUT 	1
#define	SET		1
#define	CLEAR	0

#define RS485_SIZEOF_MSGQ 10
#define RS485_SIZEOF_CBUF 8

/**PORT D E F I N I T I O N S ****************************************************/

//UART PORT DEFINITIONS
#define UART_RX_DIRECTION   TRISCbits.TRISC7
#define UART_TX_DIRECTION   TRISCbits.TRISC6
#define UART_RX_STATUS		RCSTA
#define UART_TX_STATUS		TXSTA

//ONE WIRE PORT PIN DEFINITION
///****************************************************
// This Configuration is required to make any PIC MicroController
// I/O pin as Open drain to drive 1-wire.
///****************************************************
#define OW_PIN_DIRECTION 	LATBbits.LATB2
#define OW_WRITE_PIN  		TRISBbits.TRISB2
#define OW_READ_PIN			PORTBbits.RB2


#define INPUT_PIN_1_TRIS	TRISBbits.TRISB14
#define INPUT_PIN_2_TRIS	TRISBbits.TRISB15

#define INPUT_PIN_1_LAT		LATBbits.LATB14
#define INPUT_PIN_2_LAT		LATBbits.LATB15

#define INPUT_PIN_1_READ	PORTBbits.RB14
#define INPUT_PIN_2_READ	PORTBbits.RB15

enum {
	BUTTON_1 = 0x01,
	BUTTON_2 = 0x02,
	BUTTON_3 = 0x04
};

/*OSA FLAG*/
extern OST_FLAG8   F_Button;

/******* G E N E R I C   D E F I N I T I O N S ************************************************/




#endif

/*  FIXME
#if defined(__C30__)
#define Nop() asm(" nop") 
#endif
*/
